<%@page import="com.sfd.entity.Student"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" />
		<title>员工档案</title>
		<link rel="stylesheet" type="text/css" href="../../skin/css/base.css">
		<script type="text/javascript" src="../../js/jquery.js">
</script>
		<script type="text/javascript" src="../../js/thickbox_plus.js">
</script>
		<script src="../../js/dt.js">
</script>
		<link rel="stylesheet" type="text/css" href="../../css/thickbox.css" />
<style type="text/css">
	a{
		text-decoration:none;
	}
</style>
<script language="javascript">
function viewArc(aid) {
	if (aid == 0)
		aid = getOneItem();
	window.open("archives.asp?aid=" + aid + "&action=viewArchives");
}
function editArc(aid) {
	if (aid == 0)
		aid = getOneItem();
	location = "archives.asp?aid=" + aid + "&action=editArchives";
}
function updateArc(aid) {
	location.reload();
}
function checkArc(aid) {
	var qstr = getCheckboxItem();
	if (aid == 0)
		aid = getOneItem();
	location = "archives.asp?aid=" + aid + "&action=checkArchives&qstr=" + qstr
			+ "";
}
function moveArc(aid) {
	var qstr = getCheckboxItem();
	if (aid == 0)
		aid = getOneItem();
	location = "archives.asp?aid=" + aid + "&action=moveArchives&qstr=" + qstr
			+ "";
}
function add() {
	location = "addjob.html";
}
function delArc(aid) {
	var qstr = getCheckboxItem();
	if (aid == 0)
		aid = getOneItem();
	location = "archives.asp?aid=" + aid + "&action=delArchives&qstr=" + qstr
			+ "";
}

//获得选中文件的文件名
function getCheckboxItem() {
	var allSel = "";
	if (document.form2.id.value)
		return document.form2.id.value;
	for (i = 0; i < document.form2.id.length; i++) {
		if (document.form2.id[i].checked) {
			if (allSel == "")
				allSel = document.form2.id[i].value;
			else
				allSel = allSel + "`" + document.form2.id[i].value;
		}
	}
	return allSel;
}

//获得选中其中一个的id
function getOneItem() {
	var allSel = "";
	if (document.form2.id.value)
		return document.form2.id.value;
	for (i = 0; i < document.form2.id.length; i++) {
		if (document.form2.id[i].checked) {
			allSel = document.form2.id[i].value;
			break;
		}
	}
	return allSel;
}
function selAll() {
	for (i = 0; i < document.form2.id.length; i++) {
		if (!document.form2.id[i].checked) {
			document.form2.id[i].checked = true;
		}
	}
}
function isone() {
	var count = 0;
	for (i = 0; i < document.form2.id.length; i++) {
		if (document.form2.id[i].checked) {
			count++;

		}
	}
	if (count < 1) {
		alert("没有选择数据！");
		return;
	}

	if (count > 1) {
		alert("只可选择一条信息");
		return;
	} else {
		location = "jobset.html";
	}
}
function noone() {
	var count = 0;

	for (i = 0; i < document.form2.id.length; i++) {
		if (document.form2.id[i].checked) {
			count++;
		}
	}
	if (count == 0) {

		alert("您没有选择删除目标！");
		return;
	} else {
		//alert(11);
		document.getElementById("actioncode").value = "deletestudent";
		alert(document.getElementById("actioncode").value);
		document.forms.form2.submit();
		alert("您已成功删除目标！");
		location.reload();

	}
}
function noSelAll() {
	for (i = 0; i < document.form2.id.length; i++) {
		if (document.form2.id[i].checked) {
			document.form2.id[i].checked = false;
		}
	}
}

function edit() {

	document.getElementById("actioncode").value = "updatestudent";
	alert(document.getElementById("actioncode").value);
	document.forms.form2.submit();
}
</script>
		<style type="text/css">
.t1 {
	text-align: center;
}
</style>
	</head>
	<body bgcolor="#0094D4" leftmargin="0"
		background='../../skin/images/allbg.gif'>

		<!--  快速转换位置按钮  -->
		<!--  内容列表   -->
		<form name="form2"
			action="/librarysystem/managerServlet?actioncode=deletestudent"
			method="post">

			<%
				List list_all_students = (List) request
						.getAttribute("list_all_students");
			%>
			<table width="100%" border="0" cellpadding="2" bgcolor="#D1DDAA"
				cellspacing="1" align="center" style="margin-top: 8px">
				<tr bgcolor="#ffffff"
					onMouseMove = "javascript:this.bgcolor='#149ff8';"
					onMouseOut = "javascript:this.bgcolor='#ffffff';"
				>
					<td height="24" colspan="8" align="center" bgcolor="#DAE0F1">
						<span class="t1">&nbsp;<span class="STYLE2">学生信息表</span> </span>
					</td>
				</tr>
				<tr align="center" bordercolor="#99FF00" bgcolor="#FAFAF1" onMouseMove = "javascript:this.bgcolor='#149ff8';"
					onMouseOut = "javascript:this.bgcolor='#ffffff';"
					height="22">
					<td align="center" width="7%" height="47">
						<span class="t1">选择</span>
					</td>
					<td align="center" width="12%" height="47">
						<span class="t1">学号</span>
					</td>
					<td align="center" width="14%">
						<span class="t1">学生姓名</span>
					</td>
					<td align="center" width="12%">
						性别
					</td>
					<td align="center" width="12%">
						年龄
					</td>
					<td align="center" width="14%">
						班级
					</td>
					<td align="center">
						院系
					</td>
					<td align="center" width="14%">
						基本操作
					</td>

				</tr>
				<%
					for (int i = 0; i < list_all_students.size(); i++) {
						Student student = (Student) list_all_students.get(i);
				%>
				<tr bgcolor="#FAFAF1"
					onMouseMove = "javascript:this.bgColor='#149ff8';"
					onMouseOut = "javascript:this.bgColor='#ffffff';"
				>
					<td align="center" class="t1">
						<input type="checkbox" id="id" value=<%=student.getID()%>
							name="students" />
					</td>
					<td align="center">
						<span class="t1"><%=student.getID()%></span>
					</td>
					<td align="center"><%=student.getName()%></td>
					<td align="center"><%=student.getGender()%></td>
					<td align="center"><%=student.getAge()%></td>
					<td align="center"><%=student.getClassID()%></td>
					<td align="center">
						<span class="t1"><%=student.getDepartment()%></span>
					</td>
					<td align="center">
						<a
							href="managerServlet?actioncode=updatestudent&studentID=<%=student.getID()%>">编辑</a>

					</td>
					<%
						}
					%>

					<tr bgcolor="#FAFAF1">
						<td height="28" colspan="8" align="center">
							<br />
							<span class="t1"> <a href="javascript:selAll()"
								class="coolbg">&nbsp;全选&nbsp;</a> <a
								href="javascript:noSelAll()" class="coolbg">&nbsp;取消&nbsp;</a> <a
								href="javascript:updateArc()" class="coolbg">&nbsp;更新&nbsp;</a>
								<a href="javascript:updateArc(0)" class="coolbg">&nbsp;上一页&nbsp;</a>
								<a href="javascript:updateArc(0)" class="coolbg">&nbsp;下一页&nbsp;</a>
								<!--<a href="javascript:isone()" class="coolbg">&nbsp;角色分配&nbsp;</a>-->
								<a href="javascript:noone()" class="coolbg">&nbsp;删除&nbsp;</a> </span>
						</td>
					</tr>

					<tr align="right" bgcolor="#EEF4EA">
						<td height="36" colspan="8" align="center">
							<span class="t1"> <!--翻页代码 --> </span>
						</td>
					</tr>
			</table>
			<input type="hidden" id="actioncode" name="actioncode" value="" />


		</form>
	</body>
</html>